// 小程序JS
Component({
  properties: {
    progressBarColor: {
      type: String,
      value: '#fe024f'
    },
    progressWidth: {
      type: Number,
      value: 70
    },
    progressHeight: {
      type: Number,
      value: 6
    },
    progressColor: {
      type: String,
      value: '#E5E5E5'
    },
    left: {
      type: Number,
      value: 0,
      observer: function (newVal) {
        this.setData({
          barLeft: newVal / 100 * (this.data.progressWidth - this.data.barWidth)
        });
      }
    },
    barWidth: {
      type: Number,
      value: 30
    }
  },
  data: {
    barLeft: 0
  },
  lifetimes: {
    attached: function () {
      this.setData({
        barLeft: this.properties.left / 100 * (this.properties.progressWidth - this.properties.barWidth)
      });
    }
  }
});